<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    const p = new Promise((resolve, reject)=>{
        reject("world");
        resolve("hello");
    })

    p.then(res=>{
        console.log(res);
    })
    p.catch(code=>{
        console.log(code);
    })
    // promise执行结束后，触发finally
    p.finally(()=>{
        console.log("promise已结束");
    })

    
</script>
</html>